#ifndef __UPDATE_DEAMON__
#define __UPDATE_DEAMON__

#include <goocanvas.h>

#include "theme.h"

#define NETWORK_URL ""
#define DOWNLOAD_TMP_PATH ""                //the tmp dir of the download file

#define BUILD_NUM_FILE_REMOTE_PATH "http://192.168.1.140/build"      //the url of the build num file
#define BUILD_NUM_FILE_TMP_PATH "/home/gg/work-file/marvell/alpha320-package/kine/src/sms-demo-0407/src/sms-demo-0329-diff-0331/build/tmp/build"
#define BUILD_NUM_FILE_LOCAL_PATH "/home/gg/work-file/marvell/alpha320-package/kine/src/sms-demo-0407/src/sms-demo-0329-diff-0331/build/build"        //the local path of the build num file
#define UPDATE_XML_FILE_REMOTE_PATH "http://192.168.1.140/update.xml"
#define UPDATE_XML_FILE_LOCAL_PATH "/home/gg/work-file/marvell/alpha320-package/kine/src/sms-demo-0407/src/sms-demo-0329-diff-0331/build/tmp/update.xml"


typedef enum _DOWNLOAD_WHAT {
	DOWNLOAD_NONE = 0,
	DOWNLOAD_BUILD_NUM_FILE,
	DOWNLOAD_UPDATE_XML_FILE,
	DOWNLOAD_RESOURCE_FILE
}Download_What;

typedef enum _UPDATEDEAMON_DOWNLOAD_STATUS{
	UPDATEDEAMON_DOWNLOAD_NONE = 0,
	UPDATEDEAMON_DOWNLOAD_FINISH,
	UPDATEDEAMON_DOWNLOAD_ERROR,
	UPDATEDEAMON_DOWNLOAD_DOWNLOADING
}Updatedeamon_Download_Status;

typedef struct _UpdateDeamon
{
	gpointer sms;
	int cur_build_num;      //record current build num
	int new_build_num;
	int update_timeout;     //
	char **remote_path_array;
	char **local_path_array;
	int *update_layout_array;

	Downloader *build_num_downloader;
	Downloader *update_xml_downloader;
	Downloader *resource_downloader;
	int download_status;
	int download_what;

	int update_file_count;
	int update_layout_count;
	int resource_file_download_count;
	gboolean isAllResourceDownload;
}UpdateDeamon;

UpdateDeamon *update_deamon_new(gpointer sms);
gboolean update_deamon_timeout_update(UpdateDeamon *deamon);



#endif
